﻿using System.Collections.Generic;
using System.Linq;
using P7DC.DAL.Interface;
using P7DC.Entity.Entity;

namespace P7DC.DAL.Repository
{
	public abstract class BaseRepository<TEntity, TKey> : IRepository<TEntity, TKey>
		where TEntity : BaseEntity<TKey>
	{
		public abstract IEnumerable<TEntity> Get();

		public TEntity Get(TKey id)
		{
			return Get().FirstOrDefault(e => e.Id.Equals(id));
		}
	}
}
